package com.example.tests;

public class ContactObject {
	public String firstname;
	public String lastname;
	public String address;
	public String home;
	public String mobile;
	public String work;
	public String email;
	public String email2;
	public String bday;
	public String bmonth;
	public String byear;
	public String new_group;
	public String address2;
	public String phone2;
	public String id;
	
	public ContactObject setFirstname(String firstname) {
		this.firstname = firstname;
		return this;
	}
	public ContactObject setLastname(String lastname) {
		this.lastname = lastname;
		return this;
	}
	public ContactObject setAddress(String address) {
		this.address = address;
		return this;
	}
	public ContactObject setHome(String home) {
		this.home = home;
		return this;
	}
	public ContactObject setMobile(String mobile) {
		this.mobile = mobile;
		return this;
	}
	public ContactObject setWork(String work) {
		this.work = work;
		return this;
	}
	public ContactObject setEmail(String email) {
		this.email = email;
		return this;
	}
	public ContactObject setEmail2(String email2) {
		this.email2 = email2;
		return this;
	}
	public ContactObject setBday(String bday) {
		this.bday = bday;
		return this;
	}
	public ContactObject setBmonth(String bmonth) {
		this.bmonth = bmonth;
		return this;
	}
	public ContactObject setByear(String byear) {
		this.byear = byear;
		return this;
	}
	public ContactObject setNew_group(String new_group) {
		this.new_group = new_group;
		return this;
	}
	public ContactObject setAddress2(String address2) {
		this.address2 = address2;
		return this;
	}
	public ContactObject setPhone2(String phone2) {
		this.phone2 = phone2;
		return this;
	}
	public ContactObject setId(String id) {
		this.id = id;
		return this;
	}
	@Override
	public int hashCode() {
		final int prime = 31;
		int result = 1;
		result = prime * result
				+ ((firstname == null) ? 0 : firstname.hashCode());
		result = prime * result
				+ ((lastname == null) ? 0 : lastname.hashCode());
		return result;
	}
	
	@Override
	public boolean equals(Object obj) {
		if (this == obj)
			return true;
		if (obj == null)
			return false;
		if (getClass() != obj.getClass())
			return false;
		ContactObject other = (ContactObject) obj;
		
		if (firstname == null) {
			if (other.firstname != null)
				return false;
		} else if (!firstname.equals(other.firstname))
			return false;
		
		if (lastname == null) {
			if (other.lastname != null)
				return false;
		} else if (!lastname.equals(other.lastname))
			return false;

		
		if (id != null && other.id != null) {
					return id.equals(other.id);
		} 		
		return true;
	}
	
	@Override
	public String toString() {
		return "Contact[" + id + ": " + firstname
				+ "]";
	}
	
}